#!/bin/bash

function filter() {
python -c '
import sys
import re

def fixnum(str):
    str = re.sub(":[0-9]+:", ":", str)
    str = re.sub("line [0-9]+$", "earlier line", str)
    return str
file = open(sys.argv[1])
excludes = [fixnum(line.strip()) for line in file.readlines()]
for line in sys.stdin:
    if not fixnum(line.strip()) in excludes:
	sys.stdout.write(line)
' "$@"
}

pyflakes "$@" | filter "${0%/*}/pyflakes.exclude" | sort -u
